// MainComponent.js
import React from "react";
import { View, Text, Button } from "react-native";
import { useDispatch, useSelector } from "react-redux";
import { increment, decrement } from "@store/counterSlice";

const MainComponent = () => {
    const dispatch = useDispatch();
    const counterValue = useSelector((state) => {
        return state.counter.value;
    });

    return (
        <View>
            <Text>Counter: {counterValue}</Text>
            <Button onPress={() => dispatch(increment())} title="Increment" />
            <Button onPress={() => dispatch(decrement())} title="Decrement" />
        </View>
    );
};

export default MainComponent;
